home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / html / HTMLEditorKit$InsertHRAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.7 KB  |  31 lines

  1. package javax.swing.text.html;
  2.  
  3. import java.awt.event.ActionEvent;
  4. import javax.swing.JEditorPane;
  5. import javax.swing.text.DefaultStyledDocument;
  6. import javax.swing.text.Element;
  7. import javax.swing.text.JTextComponent;
  8. import javax.swing.text.StyleConstants;
  9. import javax.swing.text.StyledEditorKit;
  10. import javax.swing.text.html.HTML.Tag;
  11.  
  12. class HTMLEditorKit$InsertHRAction extends HTMLEditorKit.InsertHTMLTextAction {
  13.    HTMLEditorKit$InsertHRAction() {
  14.       super("InsertHR", "<hr>", (HTML.Tag)null, Tag.IMPLIED, (HTML.Tag)null, (HTML.Tag)null, false);
  15.    }
  16.  
  17.    public void actionPerformed(ActionEvent var1) {
  18.       JEditorPane var2 = ((StyledEditorKit.StyledTextAction)this).getEditor(var1);
  19.       if (var2 != null) {
  20.          HTMLDocument var3 = ((HTMLEditorKit.HTMLTextAction)this).getHTMLDocument(var2);
  21.          int var4 = ((JTextComponent)var2).getSelectionStart();
  22.          Element var5 = ((DefaultStyledDocument)var3).getParagraphElement(var4);
  23.          if (var5.getParentElement() != null) {
  24.             super.parentTag = (HTML.Tag)var5.getParentElement().getAttributes().getAttribute(StyleConstants.NameAttribute);
  25.             super.actionPerformed(var1);
  26.          }
  27.       }
  28.  
  29.    }
  30. }
  31.